package com.wtz.util.learn.stringutils;

import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * Date: 2020/9/18
 * Company: www.dtstack.com
 *
 * @author tiezhu
 */
public class StringUtilsDemo {
    public static void main(String[] args) {
        List<String> testList = new ArrayList<>();

        testList.add("one");
        testList.add("two");

        System.out.println(testList.toString());

        System.out.println(StringUtils.isBlank(""));

        String[] testStr = {"this is a test demo", "hello", "WORLD", " ", ""};
//        System.out.println("isBlank -> " + isBlank(testStr));
//        System.out.println(replaceWithQuota("''stu'+'_'+sid+'_'+md5(sid)'"));
    }

    private static List<Boolean> isBlank(String[] testStr) {
        return Arrays.stream(testStr)
                .map(StringUtils::isBlank)
                .collect(Collectors.toList());
    }

    private static String replaceWithQuota(String str) {
        String removeStart = StringUtils.removeStart(str, "'");
        return StringUtils.removeEnd(removeStart, "'");
    }
}
